package com.wymobilearchitecture.study.thread;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.wymobilearchitecture.R;
import com.wymobilearchitecture.study.thread.security.AtomicTest;
import com.wymobilearchitecture.study.thread.security.ReentrantLockTest01;
import com.wymobilearchitecture.study.thread.security.ReentrantLockTest02;
import com.wymobilearchitecture.study.thread.security.SynchronizedTest;
import com.wymobilearchitecture.study.thread.use.AsyncTaskTest;
import com.wymobilearchitecture.study.thread.use.HandlerThreadTest;

public class ThreadActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activisty_thread);

        findViewById(R.id.btnAsyncTask).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new AsyncTaskTest();
            }
        });

        findViewById(R.id.btnHandlerThread).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new HandlerThreadTest();
            }
        });

        findViewById(R.id.btnThreadState).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new ThreadStateTest();
            }
        });

        findViewById(R.id.btnAtomic).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new AtomicTest();
            }
        });

        findViewById(R.id.btnSynchronized).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new SynchronizedTest();
            }
        });

        findViewById(R.id.btnReentrantLock01).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new ReentrantLockTest01();
            }
        });

        findViewById(R.id.btnReentrantLock02).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new ReentrantLockTest02();
            }
        });
    }
}
